package com.example.study.common.enums;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public enum MessageActionEnum {

    RESERVED("Reserved","getReservedData","预约成功通知"),
    EVENT_START("EventStart","getEventStartData","活动开始通知"),
    CANCELED("Canceled","getCanceledData","取消预约通知"),
    ;

    @Getter
    private String action;
    @Getter
    private String method;
    @Getter
    private String desc;


    MessageActionEnum(String action,String method, String desc) {
        this.action = action;
        this.method = method;
        this.desc = desc;
    }

    public static String getMethod(String action){
        MessageActionEnum[] values = MessageActionEnum.values();
        for (MessageActionEnum t : values) {
            if (action.equals(t.getAction())) {
                return t.getMethod();
            }
        }
        return null;
    }

    public static String getDesc(String action){
        MessageActionEnum[] values = MessageActionEnum.values();
        for (MessageActionEnum t : values) {
            if (action.equals(t.getAction())) {
                return t.getDesc();
            }
        }
        return null;
    }

}


